﻿namespace HRM.CORE.Workdesk
{
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms; using Common;
    using APP.HELPER.Utils.Language;

    public class xucCompany : UserControl
    {
        private IContainer components = null;
        private FlowLayoutPanel flowLayoutPanel1;
        private GroupControl groupControl1;
        private LinkLabel llEdit;
        private PictureEdit ptPhoto;
        private LabelControl txtAddress;
        private LabelControl txtCompany;
        private LabelControl txtEmail;
        private LabelControl txtFaxNumber;
        private LabelControl txtPhoneNumber;
        private LabelControl txtWebsite;

        public xucCompany()
        {
            this.InitializeComponent();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.txtCompany = new LabelControl();
            this.txtAddress = new LabelControl();
            this.txtPhoneNumber = new LabelControl();
            this.txtFaxNumber = new LabelControl();
            this.txtEmail = new LabelControl();
            this.txtWebsite = new LabelControl();
            this.flowLayoutPanel1 = new FlowLayoutPanel();
            this.groupControl1 = new GroupControl();
            this.llEdit = new LinkLabel();
            this.ptPhoto = new PictureEdit();
            this.flowLayoutPanel1.SuspendLayout();
            this.groupControl1.BeginInit();
            this.groupControl1.SuspendLayout();
            this.ptPhoto.Properties.BeginInit();
            base.SuspendLayout();
            this.txtCompany.AllowHtmlString = true;
            this.txtCompany.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtCompany.Appearance.Options.UseFont = true;
            this.txtCompany.Location = new Point(7, 7);
            this.txtCompany.Name = "txtCompany";
            this.txtCompany.Size = new Size(0x55, 14);
            this.txtCompany.TabIndex = 0;
            this.txtCompany.Text = "CompanyName";
            this.txtAddress.AllowHtmlString = true;
            this.txtAddress.Location = new Point(7, 0x1b);
            this.txtAddress.Name = "txtAddress";
            this.txtAddress.Size = new Size(0x27, 14);
            this.txtAddress.TabIndex = 1;
            this.txtAddress.Text = "Address";
            this.txtPhoneNumber.AllowHtmlString = true;
            this.txtPhoneNumber.Location = new Point(7, 0x2f);
            this.txtPhoneNumber.Name = "txtPhoneNumber";
            this.txtPhoneNumber.Size = new Size(30, 14);
            this.txtPhoneNumber.TabIndex = 2;
            this.txtPhoneNumber.Text = "Phone";
            this.txtFaxNumber.AllowHtmlString = true;
            this.txtFaxNumber.Location = new Point(7, 0x43);
            this.txtFaxNumber.Name = "txtFaxNumber";
            this.txtFaxNumber.Size = new Size(0x12, 14);
            this.txtFaxNumber.TabIndex = 3;
            this.txtFaxNumber.Text = "Fax";
            this.txtEmail.AllowHtmlString = true;
            this.txtEmail.Location = new Point(7, 0x57);
            this.txtEmail.Name = "txtEmail";
            this.txtEmail.Size = new Size(0x27, 14);
            this.txtEmail.TabIndex = 4;
            this.txtEmail.Text = "Website";
            this.txtWebsite.AllowHtmlString = true;
            this.txtWebsite.Location = new Point(7, 0x6b);
            this.txtWebsite.Name = "txtWebsite";
            this.txtWebsite.Size = new Size(0x18, 14);
            this.txtWebsite.TabIndex = 5;
            this.txtWebsite.Text = "Email";
            this.flowLayoutPanel1.AutoScroll = true;
            this.flowLayoutPanel1.Controls.Add(this.txtCompany);
            this.flowLayoutPanel1.Controls.Add(this.txtAddress);
            this.flowLayoutPanel1.Controls.Add(this.txtPhoneNumber);
            this.flowLayoutPanel1.Controls.Add(this.txtFaxNumber);
            this.flowLayoutPanel1.Controls.Add(this.txtEmail);
            this.flowLayoutPanel1.Controls.Add(this.txtWebsite);
            this.flowLayoutPanel1.Dock = DockStyle.Fill;
            this.flowLayoutPanel1.FlowDirection = FlowDirection.TopDown;
            this.flowLayoutPanel1.Location = new Point(2, 0x16);
            this.flowLayoutPanel1.Name = "flowLayoutPanel1";
            this.flowLayoutPanel1.Padding = new Padding(4);
            this.flowLayoutPanel1.Size = new Size(0x156, 0x99);
            this.flowLayoutPanel1.TabIndex = 6;
            this.flowLayoutPanel1.WrapContents = false;
            this.groupControl1.Controls.Add(this.llEdit);
            this.groupControl1.Controls.Add(this.ptPhoto);
            this.groupControl1.Controls.Add(this.flowLayoutPanel1);
            this.groupControl1.Dock = DockStyle.Fill;
            this.groupControl1.Location = new Point(0, 0);
            this.groupControl1.Name = "groupControl1";
            this.groupControl1.Size = new Size(0x15a, 0xb1);
            this.groupControl1.TabIndex = 7;
            this.groupControl1.Text = "Th\x00f4ng Tin C\x00f4ng Ty";
            this.llEdit.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.llEdit.AutoSize = true;
            this.llEdit.Location = new Point(0x13a, 0x1a);
            this.llEdit.Name = "llEdit";
            this.llEdit.Size = new Size(0x1a, 13);
            this.llEdit.TabIndex = 6;
            this.llEdit.TabStop = true;
            this.llEdit.Text = "Sửa";
            this.llEdit.LinkClicked += new LinkLabelLinkClickedEventHandler(this.llEdit_LinkClicked);
            this.ptPhoto.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.ptPhoto.Location = new Point(0xbb, 0x4c);
            this.ptPhoto.Name = "ptPhoto";
            this.ptPhoto.Properties.AllowFocused = false;
            this.ptPhoto.Properties.NullText = "[Chưa c\x00f3 logo]";
            this.ptPhoto.Properties.ReadOnly = true;
            this.ptPhoto.Properties.ShowMenu = false;
            this.ptPhoto.Properties.SizeMode = PictureSizeMode.Zoom;
            this.ptPhoto.Size = new Size(0x99, 0x60);
            this.ptPhoto.TabIndex = 7;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
//            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.groupControl1);
            base.Name = "xucCompany";
            base.Size = new Size(0x15a, 0xb1);
            this.flowLayoutPanel1.ResumeLayout(false);
            this.flowLayoutPanel1.PerformLayout();
            this.groupControl1.EndInit();
            this.groupControl1.ResumeLayout(false);
            this.groupControl1.PerformLayout();
            this.ptPhoto.Properties.EndInit();
            base.ResumeLayout(false);
        }

        private void llEdit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            //XfmCompany company = new XfmCompany();
            //company.Success += s => this.LoadData();
            //company.ShowDialog();
        }

        public void LoadData()
        {
            this.groupControl1.Text = MultiLanguages.GetString("tbl_DashBoard", "CompanyInformation", "Th\x00f4ng Tin C\x00f4ng Ty");
            //if (MyInfo.Get(MyEncryption.Encrypt("ERP01", "123654", true)) == "OK")
            {
                this.txtCompany.Text = "";//MyInfo.Company;
                this.txtAddress.Text = "Địa chỉ: " + "";// MyInfo.Address;
                this.txtPhoneNumber.Text = "ĐT: " + "";//MyInfo.Tel;
                this.txtFaxNumber.Text = "Fax: " + "";//MyInfo.Fax;
                this.txtWebsite.Text = "Website: <color=darkblue>" + "" + "</color>";//MyInfo.WebSite + "</color>";
                this.txtEmail.Text = "Email: <color=darkblue>" + "" + "</color>";//MyInfo.Email + "</color>";
                this.ptPhoto.Image = null;//MyInfo.Photo;
            }
        }
    }
}

